import { staticHost } from '@/api/utils/image';
import { defineStore } from 'pinia';
import { baseUrlOptions } from './options';
import type { SystemStore } from './types';
/* 从vite环境变量中读取 `默认后端地址` */
const baseURL = import.meta.env.VITE_BASEURL;
const useSystemStore = defineStore('system', {
  state: (): SystemStore => ({
    developer: {
      baseURL,
      urlSelection: baseUrlOptions,
      timeout: 8,
      resourceHost: staticHost.value,
    },
    version: '',
    program: {
      notepad: [],
    },
    gen: {
      frontendRoot: '',
      backendRoot: '',
      parentId: '0',
      moduleName: '',
      packageName: '',
    },
    starList: [],
  }),
  persist: true,
});

export default useSystemStore;
